<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者，助力中小企业发展 
+----------------------------------------------------------------------
| Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
+----------------------------------------------------------------------
| 沃德代驾系统并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
+----------------------------------------------------------------------
| 活动规则 开发者: 麦沃德科技-半夏  
+---------------------------------------------------------------------- -->

<template>
	<view class="container" v-if="loadEnd">
		<mp-html :content="content"></mp-html>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 加载完成
				loadEnd: false,
				// 协议内容
				content: "",
			}
		},
		onLoad() {
			uni.showLoading({
				title: "加载中"
			})
			this.getAgreementInfo(() => {
				this.loadEnd = true
				uni.hideLoading()
			})
		},
		methods: {
			// 获取协议内容
			getAgreementInfo(fn) {
				this.$util.request("passenger.invitation.agreement").then(res => {
					if (fn) fn()
					if (res.code == 1) {
						this.content = res.data.content
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				}).catch(error => {
					console.error('获取协议内容 ', error)
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.container {
		padding: 32rpx;
		color: #242629;
		font-size: 28rpx;
		line-height: 40rpx;
	}
</style>